/**
 * @param {number[]} nums
 * @return {number[]}
 */
 var singleNumbers = function(nums) {
    let n=nums.length;
    let r1=0;
    for(let i of nums){
        r1^=i;
    }
    let div=1;
    while((div&r1)==0){
        div<<=1;
    }
    let a=0,b=0;
    for(let i of nums){
        if(div&i){
            a^=i;
        }
        else{
            b^=i;
        }
    }
    return [a,b];
};